local skel = fk.CreateSkill {
  name = "efengqi__hunzi",
  tags = {Skill.Wake, Skill.Lord},
}

Fk:loadTranslationTable{
  ["efengqi__hunzi"] = "魂姿",
  [":efengqi__hunzi"] = "主公技，觉醒技，准备阶段，若你的体力值为1，令非吴势力角色依次将体力值扣减至1。",

  ["$efengqi__hunzi1"] = "父亲在上，魂佑江东；公瑾在旁，智定天下！",
  ["$efengqi__hunzi2"] = "愿承父志，与公瑾共谋天下！",
}

skel:addEffect(fk.EventPhaseStart, {
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(skel.name) and player.phase == Player.Start and
      player:usedSkillTimes(skel.name, Player.HistoryGame) == 0
  end,
  can_wake = function(self, event, target, player, data)
    return player.hp == 1
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local targets = table.filter(room:getAlivePlayers(), function(p) return p.kingdom ~= "wu" end)
    if #targets > 0 then
      room:doIndicate(player, targets)
      for _, p in ipairs(targets) do
        if p.hp > 1 then
          room:loseHp(p, p.hp - 1, skel.name)
        end
      end
    end
  end,
})

return skel
